package com.admin.boot.modules.system.service.impl;

import com.admin.boot.modules.system.entity.SysRole;
import com.admin.boot.modules.system.mapper.SysRoleMapper;
import com.admin.boot.modules.system.service.ISysRoleService;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;

import java.util.List;


/**
* (SysRole)表服务实现类
*
* @author makejava
* @since 2024-01-12
*/
@Service("sysUserService")
public class SysRoleServiceImpl extends ServiceImpl<SysRoleMapper,  SysRole> implements ISysRoleService{


    @Override
    public SysRole getByCode(String roleCode) {
        LambdaQueryWrapper<SysRole> queryWrapper = new LambdaQueryWrapper<>();
        queryWrapper.eq(SysRole::getCode,roleCode);
        List<SysRole> list = this.list(queryWrapper);
        return CollectionUtils.isEmpty(list)?null:list.get(0);
    }
}
